﻿using System;
using System.Collections.Generic;
using System.Data;
using ContractManager.Entity.Base;
using Speed.Data;

namespace ContractManager.BLL.Business
{
    public static class ClsMyCo
    {
        public static List<AS_Sys_MyCo_Year> SelectAll()
        {
            using (var db = Sys.NewDb())
            {
                return Data.Base.AS_Sys_MyCo_Year.Select(db);
            }
            
        }

        public static DataTable GetAll()
        {
            using (var db = Sys.NewDb())
            {
                return db.ExecuteDataTable("EXEC dbo.usp_AS_Sys_MyCo_YearSelectAll");
            }
            
        }

        public static void Insert(AS_Sys_MyCo_Year capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Insert<AS_Sys_MyCo_Year>(capital);
            }
            
        }

        public static void Update(AS_Sys_MyCo_Year capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Update<AS_Sys_MyCo_Year>(capital);
            }
            
        }

        public static AS_Sys_MyCo_Year SelectByPk(Int32 capId)
        {
            using (var db = Sys.NewDb())
            {
                return db.SelectSingle<AS_Sys_MyCo_Year>(string.Format("AS_Sys_MyCo_Year_ID={0}", capId));
            }
            
        }

        public static int DeleteByPk(Int32 capId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Delete<AS_Sys_MyCo_Year>(string.Format("AS_Sys_MyCo_Year_ID={0}", capId));
            }
            
        }
    }
}